{% extends "cm_s/admin/admin_base.html" %}

{% block title %}Index of all pages{% endblock %}

{% block article %}

    <h1>Index of all pages</h1>
	<p>Set main page</p>
	<form action="." method="POST">
    <table>
    {{ form }}
    </table>
    <input type="submit" value="Submit">
    </form>
    <p><a href="{% url cm_s_admin_create %}">New page</a></p>
	<h2>Existing pages</h2>
    {% if pages %}
        {% for page in pages %}
            <div>
            	<a href="{% url cm_s_admin_edit page.slug %}">{{ page.title }}</a>
				<form action="{% url cm_s_admin_delete %}" method="POST">
					<input type="hidden" name="slug" value="{{ page.slug }}">
			        <input type="submit" value="Delete">
			    </form>
			</div>
        {% endfor %}
    {% else %}
       <p>No pages yet.</p>
    {% endif %}
{% endblock %}